Repository navigation
Resize - #2
Resize#2Ayush-Vish wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
❌ Deploy Preview for shellsync failed.
|
There was a problem hiding this comment.
Pull Request Overview
This PR implements terminal resizing functionality for ShellSync, allowing users to dynamically resize terminals in real-time across all connected clients. The implementation adds comprehensive support for terminal resizing through UI controls, WebSocket messaging, and proper PTY management.
- Added terminal resize controls (minimize, maximize, and incremental resize buttons) to the frontend
- Implemented WebSocket messaging for broadcasting resize events between clients
- Enhanced the gRPC protocol and agent to handle PTY resize operations
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| nano.18028.save | Temporary save file with test content |
| frontend/src/lib/types.ts | Added width/height properties to canvas items and socket messages |
| frontend/src/hooks/useSocket.ts | Added resize event handling and removed chunkNum parameter |
| frontend/src/components/terminal/Terminal.tsx | Enhanced terminal component with fit functionality and dimension getters |
| frontend/src/components/terminal/DraggableTerminal.tsx | Implemented comprehensive resize UI controls and dimension management |
| frontend/src/app/ws/[slug]/page.tsx | Added resize message handling and position update broadcasting |
| client/controller/controller.go | Added PTY resize functionality and size management |
| backend/internal/websocket/hub.go | Implemented resize and position update message handling |
| backend/internal/types/shared.go | Added resize command types and updated message structures |
| backend/internal/service/service.go | Added resize command forwarding to agents |
| api/proto/shellsync.proto | Added TerminalResize message type to protocol |
| api/proto/shellsync.pb.go | Generated protobuf code for resize functionality |
| Readme.md | Updated documentation with improved formatting and feature descriptions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,2 @@ | |||
| lssdks | |||
There was a problem hiding this comment.
The content 'lssdks' appears to be a typo or test input that should be removed.
| lssdks |
| const cols = Math.max(10, Math.floor(dimensions.width / 8)); | ||
| const rows = Math.max(5, Math.floor(dimensions.height / 16)); |
There was a problem hiding this comment.
Magic numbers 8 and 16 are used for calculating terminal columns and rows. These should be defined as named constants to improve maintainability and make the character/line dimensions explicit.
| cols: Math.floor((newWidth - 20) / 9), // Approximate columns based on width | ||
| rows: Math.floor((newHeight - 100) / 17), // Approximate rows based on height |
There was a problem hiding this comment.
Different magic numbers (9, 17, 20, 100) are used here compared to the sendSizeUpdate function. This inconsistency could lead to bugs. Use the same calculation method or define these as shared constants.
| <button | ||
| onClick={() => handleResize(-10, -10)} | ||
| className="resize-button p-1 hover:bg-gray-600 rounded text-gray-400 hover:text-white transition-colors" | ||
| title="Decrease size (-10px)" |
There was a problem hiding this comment.
The hardcoded resize increment of 10px should be defined as a constant to make it easily configurable and consistent with the handleResize function calls.
No description provided.